//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.example.springpoc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class JSONController {
    public JSONController() {
    }

    @RequestMapping(
        value = {"/"},
        method = {RequestMethod.GET},
        produces = {"application/json;charset=UTF-8"}
    )
    @ResponseBody
    public Object getUser() {
        User user = new User();
        user.setName("Bob");
        user.setAge(25);
        return user;
    }

    @RequestMapping(
        value = {"/"},
        method = {RequestMethod.POST},
        produces = {"application/json;charset=UTF-8"}
    )
    @ResponseBody
    public Object setUser(@RequestBody User user) {
        user.setAge(20);
        return user;
    }
}
